import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;

//字符流
public class Ts220054070558 {
    public static void main(String[] args) throws IOException {
        //读
        FileReader fr = new FileReader("D:\\Hello220054070558.java");
        //写
        FileWriter fw = new FileWriter("D:\\Hc220054070558.java");

        char[] buffer = new char[1024];
        int temp = 0;
        while ((temp = fr.read(buffer)) != -1) {
            String content = new String(buffer,0,temp);
            System.out.println(content);
            fw.write(buffer,0,temp);
            fw.flush(); // 刷新 FileWriter 的缓冲区
        }

    }
}
